package com.anthony.app.common.widgets.imageloader;

import android.content.Context;

import javax.inject.Inject;

/**
 * Created by Anthony on 2016/3/3.
 * Class Note:
 * use this class to load image,single instance
 */
public class ImageLoaderUtil {

    public static final int PIC_LARGE = 0;
    public static final int PIC_MEDIUM = 1;
    public static final int PIC_SMALL = 2;

    public static final int LOAD_STRATEGY_NORMAL = 0;
    public static final int LOAD_STRATEGY_ONLY_WIFI = 1;

//    private static ImageLoaderUtil mInstance;
    private BaseImageLoaderStrategy mStrategy;

    @Inject
    public ImageLoaderUtil(){
        mStrategy =new GlideImageLoaderStrategy();
    }

//single instance
//    public static ImageLoaderUtil getInstance(){
//        if(mInstance ==null){
//            synchronized (ImageLoaderUtil.class){
//                if(mInstance == null){
//                    mInstance = new ImageLoaderUtil();
//                    return mInstance;
//                }
//            }
//        }
//        return mInstance;
//    }


    public void loadImage(Context context,ImageLoader img){
        mStrategy.loadImage(context,img);
    }

    public void setLoadImgStrategy(BaseImageLoaderStrategy strategy){
        mStrategy =strategy;
    }
}
